package org.zhadoop.stream.cql.semanticanalyzer.parser;

import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.CharStream;

/**
 * 忽略大小写的antlr 处理规则
 * antlr 中默认是区分大小写的，但是CQL语句中对关键词是不区分的
 * 所以要在进行分析的时候，忽略关键词的大小
 * @author zwd
 *
 */
public class ANTLRIgnoreCaseStringStream extends ANTLRInputStream{
	
	public ANTLRIgnoreCaseStringStream(String input) {
		super(input);
	}
	
	@Override
	public int LA(int i) {
		int returnChar = super.LA(i);
		if(returnChar == CharStream.EOF){
			return returnChar;
		}else if(returnChar == 0){
			return returnChar;
		}
		return Character.toUpperCase((char)returnChar);
	}
}
